﻿
namespace SaiLing
{
    public class RegexPatterns
    {
        /// <summary>
        /// See http://en.wikipedia.org/wiki/Email_address#Syntax
        /// </summary>
        public const string Email = @"^\s*[a-zA-Z0-9!#$%&'*+\-/=?^_`{|}~]+(\.[a-zA-Z0-9!#$%&'*+\-/=?^_`{|}~]+)*@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([a-zA-Z0-9\-]+\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})\s*$";
        /// <summary>
        /// 
        /// </summary>
        public const string Domain = @"\s*[\w.-]+\.[a-z]{2,4}\s*";
        /// <summary>
        /// 
        /// </summary>
        public const string Alphanum = @"[\w\d_]+";
        /// <summary>
        /// 
        /// </summary>
        public const string Version = @"^([0-9]+)\.([0-9]+)\.([0-9]+)\.([0-9])+$";
        /// <summary>
        /// 
        /// </summary>
        public const string HttpUrl = @"(http|https):\/\/([\w\-_]+(\.[\w\-_]+)+|localhost)([\w\-\.,@?^=%&amp;:/~\+#]*[\w\-\@?^=%&amp;/~\+#])?";
        /// <summary>
        /// 
        /// </summary>
        public const string SimpleName = @"^[A-Za-z][\w]*$";
        /// <summary>
        /// 
        /// </summary>
        public const string FileName = @"^[^\\\./:\*\?\""<>\|~ ]{1}[^\\/:\*\?\""<>\|~ ]{0,254}$";

        public const string NoHtml = @"<[^>]+>";

        /// <summary>
        /// 品牌 首字母
        /// </summary>
        public const string BrandChar = @"^[a-zA-Z]";

        /// <summary>
        /// 品牌英文名称
        /// </summary>
        public const string EnglishName = @"^[a-zA-Z][0-9a-zA-Z]+";
        /// <summary>
        /// 
        /// </summary>
        public const string IP = @"\b(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\b";
        /// <summary>
        /// 
        /// </summary>
        public const string UserName = @"^[a-zA-Z]\w*$";

        /// <summary>
        /// The veriable name
        /// </summary>
        public const string VeriableName = "^[a-zA-Z_][a-zA-Z0-9_]*$";
        /// <summary>
        /// 电话号码(包含固定电话和移动电话)
        /// </summary>
        public const string Phone = @"(^(0[0-9]{2,3}\-)?([2-9][0-9]{6,7})+(\-[0-9]{1,4})?$)|(^(((13[0-9]{1})|(14[0-9]{1})|(15[0-9]{1})|(18[0-9]{1})|(17[0-9]{1}))+\d{8})$)";
        /// <summary>
        /// 移动电话
        /// </summary>
        public const string MobilePhone = @"^(((13[0-9]{1})|(14[0-9]{1})|(15[0-9]{1})|(18[0-9]{1})|(17[0-9]{1}))+\d{8})$";
        /// <summary>
        /// 固定电话
        /// </summary>
        public const string TelPhone = @"^(0[0-9]{2,3}\-)?([2-9][0-9]{6,7})+(\-[0-9]{1,4})?$";
        /// <summary>
        /// 微信模板消息参数
        /// </summary>
        public const string WeChatTemplateParameter = @"\{\{[\w]+.DATA\}\}";
        /// <summary>
        /// 金钱 2位小数
        /// </summary>
        public const string Price = @"^(0|[1-9][0-9]{0,9})(\.[0-9]{1,2})?$";
        /// <summary>
        /// 3位小数
        /// </summary>
        public const string ThreeDecimal = @"^(0|[1-9][0-9]{0,9})(\.[0-9]{1,3})?$";

        /// <summary>
        /// 正整数
        /// </summary>
        public const string PositiveInteger = @"^[0-9]*[1-9][0-9]*$";


        public const string Video =
            @"<(?<HtmlTag>div)[^>]*?>((?<Nested><\k<HtmlTag>[^>]*>)|</\k<HtmlTag>>(?<-Nested>)|.*?)*</\k<HtmlTag>>";
        /// <summary>
        /// 车牌号
        /// </summary>
        public const string PlateNo = @"^[京津沪渝冀豫云辽黑湘皖鲁新苏浙赣鄂桂甘晋蒙陕吉闽贵粤青藏川宁琼使领A-Z]{1}[A-Z]{1}[A-Z0-9]{4}[A-Z0-9挂学警港澳]{1}$";
    }
}
